package com.jiuzhou.crawlers.taobao.processor.taobao;

import java.util.List;

import org.apache.http.HttpHost;

import com.jiuzhou.crawlers.taobao.processor.taobao.constant.CommonConstant;
import com.jiuzhou.crawlers.taobao.processor.taobao.urlstrategy.ITaobaoClawerStrategy;
import com.jiuzhou.crawlers.taobao.processor.taobao.urlstrategy.ITaobaoTypeObtainStrategy;
import com.jiuzhou.crawlers.taobao.processor.taobao.urlstrategy.impl.PreocessorStrategyImpl;
import com.jiuzhou.crawlers.taobao.processor.taobao.urlstrategy.impl.TypeStrategyImpl;
import com.jiuzhou.crawlers.taobao.util.ProxyManagerUtil;

import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;
import us.codecraft.webmagic.selector.Json;

public class TaoBaoProcessor   implements PageProcessor{
	   public  List<String[]> proxyList  =ProxyManagerUtil.getProxyList() ;
	   private Site site =  Site.me().setCycleRetryTimes(3).setSleepTime(1000).setTimeOut(8000).setUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36"); //站点设置

	@Override
	public Site getSite() {
		// TODO Auto-generated method stub
		return site;
	}


	@Override
	public void process(Page page) {
		ITaobaoClawerStrategy clawerStrategy = new PreocessorStrategyImpl();
		ITaobaoTypeObtainStrategy typeStrategy = new TypeStrategyImpl();
		//爬取商品类别
		//typeStrategy.getTypeBySearch(page);
	    //clawerStrategy.useWorldUrl(page);
		typeStrategy.getTypeByAllSorts(page);
		clawerStrategy.useWorldUrl(page);
	

 }

}
